package icu.yougan.youganblogbackend.controller;

import icu.yougan.youganblogbackend.model.LoginRequest;
import icu.yougan.youganblogbackend.model.LoginResponse;
import icu.yougan.youganblogbackend.service.UserService;
import icu.yougan.youganblogbackend.common.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/api/auth")
public class AuthController {

    @Autowired
    private UserService userService;

    @PostMapping("/login")
    public Result<LoginResponse> login(@RequestBody LoginRequest loginRequest) {
        return userService.login(loginRequest);
    }
} 